<template>
	<view class="content">
		<!--产品，客户列表 -->
		<receiptTow ref="receiptTow" 
			@setGoodsThree="setGoodsThree" 
			@setCustomInfo="setCustomInfo" 
			@scanGunSelectGds="scanGunSelectGds"
			@addNewGoods="addNewGoods"></receiptTow>
		
		<!-- 开单页面 -->
		<receiptThree ref="receiptInfo" 
			@addCustom="addCustom" 
			@selectReceiptGoods="selectReceiptGoods"
			@editCart="editCart"
			@checkOut="checkOut"
			@setGdCustomIdNull="setGdCustomIdNull">
		</receiptThree>
		
		<!-- 添加产品 -->
		<!-- <goodsAdd  ref="goodsAdd" v-show="curIndex == 2" :actType="actType"></goodsAdd> -->
		<!--设置菜单 -->
	</view>
</template>

<script>
	import receiptTow from '../../components/receipt/ReceiptTow.vue';
	import receiptThree from '../../components/receipt/ReceiptThree.vue';
	import staticConst from '../../js/const/StaticConst.js';
	import goodsAdd from "../../components/goods/GoodsAdd.vue";
	import eventCtrl from "../../js/event/EventCtrl.js";
	import goodsCtrl from "../../js/gd/GoodsCtrl.js";
	
	export default {
		components: { 
			receiptTow, receiptThree},
		data() {
			return {
				curPage:staticConst.MD_KD,
				showSetMenu:false,
				isClickSetBtn:false,
				actType:0 ,// 0:新增产品 1：编辑产品
				isNotData :false, // 没有数据
			}
		},
		
		onLoad() {
			
		},
		
		onShow() {
		},
		
		onHide() {
		},
		
		onUnload() {
		},
		
		onReady() {
			this.$refs.receiptTow.initData();
			this.$refs.receiptInfo.initData();
		},
				
		methods: {
			/***点击产品列表处理**/
			setGoodsThree(data)
			{
				
				this.$refs.receiptInfo.addGoodsReceipt(data);
			},
			
			/****设置开单用户*******/
			setCustomInfo(data,isCheckOut)
			{
				this.$refs.receiptInfo.getCustomInfo(data,isCheckOut);
			},
		
			/***切换客户***/
			addCustom()
			{
				this.$refs.receiptTow.selectedCustomGoodsList(2);
			},
			/***切换产品列表*****/
			selectReceiptGoods()
			{
				this.$refs.receiptTow.selectedCustomGoodsList(1);
			},
			
			/****编辑购物车***/
			editCart()
			{
				this.$refs.receiptTow.setGoodIdIsNull();
			},
			
			/****check out 结算****/
			checkOut(value)
			{
				this.$refs.receiptTow.checkOut(value);
			},
			
			/****放弃开单，开单成功****/
			setGdCustomIdNull()
			{
				this.$refs.receiptTow.setGdCustomIdNull();
			},
			
			/*****扫码枪搜产品选中******/
			scanGunSelectGds(gdInfo)
			{
				this.$refs.receiptInfo.scanGunSelectGds(gdInfo);
			},
			
			/****扫码找不到产品，就添加产品****/
			addNewGoods()
			{
				// this.$refs.changeTab.goods();
			},
		},
	}
</script>
<style lang="scss" scoped>
	.content
	{
		display: flex;
		justify-content: flex-start;
		min-width: 820px;
		height: 100%;
		position: relative;
	}
</style>